﻿using System;
using System.Collections.Generic;
using System.Text;

using Obsidian.Edm;

namespace Obsidian.Data
{
    public class ServerCache : ICache
    {
        public void Set<T>(string key, T value) where T : IModel, new()
        {
            MemCached.Set<T>(key, value);
        }

        public void Set<T>(string key, T value, int validTime) where T : IModel, new()
        {
            MemCached.Set<T>(key, value, -1);
        }

        public void Set(string key, object value)
        {
            //MemCached.Set(key, value);
        }

        public void Set(string key, object value, int validTime)
        {
            //MemCached.Set(key, value, validTime);
        }

        public bool Exists<T>(string key) where T : IModel, new()
        {
            return MemCached.Exists<T>(key);
        }

        public void Delete<T>(string key) where T : IModel, new()
        {
            MemCached.Delete<T>(key);
        }

        public T Get<T>(string key) where T : IModel, new()
        {
            return MemCached.Get<T>(key);
        }

        public object Get(string key)
        {
            return MemCached.Get(key);
        }
    }
}
